/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ace.system.sound;

import ace.system.Utilities;

/**
 *
 * @author TimotiusNC
 */
public class SFXPlayer {
	public static final int SFX_NUMBERS	= 5;
	
	public static final int SFX_CURSOR	= 0;
	public static final int SFX_SELECT	= 1;
	public static final int SFX_CANCEL	= 2;
	public static final int SFX_ERROR	= 3;
	public static final int SFX_BUILD	= 4;

	public SFXPlayer(){
		m_simplePlayers = new SimplePlayer[SFX_NUMBERS];
		m_SFXNames = new String[] {
			"/tes.mp3",
			"/select.wav",
			"/cancel.wav",
			"/error.wav",
			"/build.wav",
		};

		for(int i=0; i<SFX_NUMBERS; ++i){
			m_simplePlayers[i] = new SimplePlayer();
			if(i == 0)
				m_simplePlayers[i].setSong(Utilities.SFX_FOLDER + m_SFXNames[i], "audio/mpeg", SimplePlayer.LOOP_ONCE);
			else
				m_simplePlayers[i].setSong(Utilities.SFX_FOLDER + m_SFXNames[i], "audio/x-wav", SimplePlayer.LOOP_ONCE);
		}

		isMute = false;
	}

	public void playSFX(int SFXIdx){
		if(isMute)	return;
		m_simplePlayers[SFXIdx].startPlayer();
	}

	public void setMute(boolean mute){
		isMute = mute;
	}

	protected SimplePlayer[]	m_simplePlayers;
	protected String[]			m_SFXNames;
	protected boolean			isMute;
}
